package com.hxcy.detail;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

public class ListFragment extends Fragment {


    private static  String thisTitle ;

    private ViewPager mViewpager;

    private RecyclerView mRv;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_list, container, false);
        mRv = view.findViewById(R.id.rv_fragment);
        mRv.setLayoutManager(new LinearLayoutManager(view.getContext()));
        mRv.setAdapter(new HomeAdapter(getChildFragmentManager(), setfargment()));
        return view;
    }

    /**
     * 添加Fragment
     */

    private List<String> list;

    private List<String> setfargment() {
        list = new ArrayList<String>();
        for (int i = 0; i < 100; i++) {
            list.add("我是第 "+i+" 条数据");
        }
        return list;
    }
}
